package InputArray;

import java.util.Scanner;
import java.util.Stack;

public class ResersedOrder {
    public static void main(String[] args) {
        System.out.println("请输入10个整数：");
        int array[]=new int[10];
        Stack stack=new Stack();
        Scanner sc =new Scanner(System.in);
        for (int i=0;i<10;i++)
        {
            while (!sc.hasNextInt())//判断输入的是否为整数
            {
                System.out.println("第"+i+"个不是数字，请重新输入（输入值将放入数组尾部）");
                sc.next();
            }
            array[i]=sc.nextInt(); stack.push(array[i]);

        }

        for (int i=0;i<10;i++)//数组出栈
        {
            System.out.print(stack.pop()+" ");
        }
    }
}
